from django.urls import path, re_path
from .views import myhello, index, index1, index2, index_dict, tesurl
    # index_obj
from .views import downfile, downloadfile

from .views import geturlinfo, geturlpathinfo, csdn, tespath, book, quesioneight

from .views import myform, myform2, myform_post, myform_single, show, upfile, jsontest

# from shool import views
from .views import testredirect, testfun, question2,testtem,student

from .views import testrelation,paging,pagedjango,queryobj
urlpatterns = [
    path('downfile/', downfile, name='downfile'),
    path('downloadfile/<str:filename>', downloadfile, name='downloadfile'),

    path('myhello/', myhello, name='myhello'),
    path('index/', index, name='index'),
    path('index1/', index1, name='index1'),
    path('index2/', index2, name='index2'),
    path('index_dict/', index_dict, name='index_dict'),

    # path('index_obj/', index_obj, name='index_obj'),
    # --------------------------------------
    path('geturlinfo/', geturlinfo, name='geturlinfo'),
    # /username/article/details/blogid
    #     <数据类型:变量名称>
    path('geturlpathinfo/<int:blogid>', geturlpathinfo, name='geturlpathinfo'),

    # str 包含的范围更广
    path('<str:username>/article/details/<int:blogid>', csdn, name='csdn'),
    # path 比str 包含更广, 包括斜杠 /
    path('testpath/<path:mypath>', tespath, name='tespath'),
    # ---------------------------------------------------
    # 路径/(?P<组名/变量名>正则规则)
    # re_path("book/(?P<bookid>\d{1,3})",book,name="book"),
    re_path("book/(?P<bookid>[0-9]{,3})", book, name="book"),  # 1111111
    # re_path("book/(?P<bookid>[0-9]{,3})$",book,name="book"), # 999
    # 如何获取 url中参数
    # 如何获取url中路径信息
    # int str path 关系   书写代码前后对应关系
    # 获取 /p/e9a29493bd23 路径中  e9a29493bd23
    # 获取 /p/68d3f6f1ae11 路径中  68d3f6f1ae11

    # path("<str:lantype>/<str:version>/ref/settings",quesioneight,name="quesioneight"),
    re_path("^(?P<lantype>\w{2})/(?P<version>[0-9.]{2,5})/ref/settings", quesioneight, name="quesioneight"),
    #   re_path(路径/(?P<组名/变量名>正则规则),视图函数,别名)

    path("myform/", myform, name="myform"),

    # 获取传过来的数据
    path("myform2/", myform2, name="myform2"),

    # 返回 收集数据的form表单
    path("myform_post/", myform_post, name="myform_post"),

    # 有没有一种可能, 我们用一个 路由 一个视图函数 来完成
    path("myform_single/", myform_single, name="myform_single"),

    path("show/", show, name="show"),

    path("upfile/", upfile, name="upfile"),
    path("jsontest/", jsontest, name="jsontest"),

    # -------------------day5---------------------------

    # path("testredirect/", testredirect, name="testredirect"),

    path("question2/", question2, name="question2"),
    path("testfun/", testfun, name="testfun"),

    path('tesurl/', tesurl, name='tesurl'),
    #     模板语法 四种 注释 {#这是注释#}  {{变量}}  {% url 标签 关键字%}  | 过滤器
    path("testtem/",testtem,name='testtem'),

    path("student/",student,name='student'),
    path("testrelation/",testrelation,name='testrelation'),

    # ---------------day10-------------

    path("paging/",paging,name='paging'),
    path("pagedjango/",pagedjango,name='pagedjango'),
    path("queryobj/",queryobj,name='queryobj'),

]
